Skip to content

[HZ-5465] Enable lock APIs with Asyncio#820

Open
yuce wants to merge 6 commits into
hazelcast:masterfrom
yuce:asyncio-lock2
Open

[HZ-5465] Enable lock APIs with Asyncio#820
yuce wants to merge 6 commits into
hazelcast:masterfrom
yuce:asyncio-lock2

Conversation

@yuce

@yuce yuce commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This PR adds the task ID to be used instead of the thread ID for the asyncio API.
This task ID is produced using:

id(asyncio.current_task())

The builtin id function returns an integer which is guaranteed to be unique among existing objects.
The returned id is derived from the memory location of the object in CPython (the only Python implementation we officially support).
See: https://docs.python.org/3/library/functions.html#id
The address space limit for 64bit systems is 52bits (AMD64) to 56bits (ARM64), so the id fits into a long comfortably:
See: https://en.wikipedia.org/wiki/64-bit_computing#Limits_of_processors
Since the task itself is an object, the id can be used as a pseudo-id for the task.
When the task ends, the id can be assigned to another task, but that's not an issue, since the task id is used to distinguish between running tasks.

Updated the Map, MultiMap, and Semaphore proxies to use the task ID.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.65138% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.16%. Comparing base (ec03ad8) to head (b8084b0).

Files with missing lines Patch % Lines
hazelcast/internal/asyncio_proxy/map.py 80.76% 10 Missing ⚠️
hazelcast/internal/asyncio_proxy/multi_map.py 78.72% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #820      +/-   ##
==========================================
- Coverage   94.22%   94.16%   -0.06%     
==========================================
  Files         411      411              
  Lines       27427    27511      +84     
==========================================
+ Hits        25844    25907      +63     
- Misses       1583     1604      +21     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yuce yuce requested a review from emreyigit June 11, 2026 15:17
@yuce yuce changed the title Enable lock APIs with Asyncio [HZ-5465] Enable lock APIs with Asyncio Jun 11, 2026
@yuce yuce added this to the 5.7.0 milestone Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants